package com.zsk.shop.controller.base;

import com.zsk.shop.common.base.BaseResponse;
import com.zsk.shop.model.params.EditDataDictionaryParams;
import com.zsk.shop.model.results.DataDictionaryListResult;
import com.zsk.shop.service.DataDictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 数据字典
 *
 * @Author ljh
 */
@RestController
@Api(tags = "数据字典")
@RequestMapping("/dataDictionary")
public class DataDictionaryController {

    @Resource
    private DataDictionaryService dataDictionaryService;

    /**
     * 修改
     *
     * @param params
     * @return
     */
    @PostMapping("/edit.do")
    @ApiOperation("gop修改数据字典")
    public BaseResponse edit(@RequestBody @Validated EditDataDictionaryParams params) {
        return dataDictionaryService.edit(params);
    }

    /**
     * 列表
     *
     * @param name
     * @param value
     * @return
     */
    @ApiOperation("gop数据字典列表")
    @GetMapping("/dataDictionaryList.do")
    @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "参数名称"),
            @ApiImplicitParam(name = "value", value = "参数值"),
            @ApiImplicitParam(name = "page"),
            @ApiImplicitParam(name = "size")})
    public BaseResponse<DataDictionaryListResult> dataDictionaryList(String name, String value) {
        return dataDictionaryService.dataDictionaryList(name, value);
    }

}
